<?php

namespace JsonLowCode\Form\Fields;


/**
 * 货币字段
 */
class CurrencyField extends NumberField
{
    protected function booted(): void
    {
        parent::booted();
        $this->defaultValue(0.00)->prefix("￥");
    }

    /**
     * 设置placeholder
     * @param string|null $placeholder
     * @return $this
     */
    public function placeholder(string $placeholder = null): static
    {
        $this->placeholder = $placeholder;
        return $this;
    }

    protected function render(): void
    {
        if ($this->placeholder!=null){
            $this->element->placeholder($this->placeholder);
        }
    }
}
